<!DOCTYPE html>
<html>
<head>
    <title>动态时钟</title>
    <style>
        body {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100vh;
            margin: 0;
            font-family: Arial, sans-serif;
        }
        h1 {
            margin-bottom: 20px;
            color: #333;
        }
        #clock {
            font-size: 48px;
            font-weight: bold;
            background: #f0f0f0;
            padding: 20px 40px;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }
    </style>
</head>
<body>
    <h1>当前时间</h1>
    <div id="clock"></div>

    <script>
        function updateTime() {
            const now = new Date();
            const hours = now.getHours();
            const minutes = String(now.getMinutes()).padStart(2, '0');
            const seconds = String(now.getSeconds()).padStart(2, '0');
            document.getElementById('clock').textContent = `${hours}:${minutes}:${seconds}`;
        }

        // 立即执行一次避免初始空白
        updateTime();
        // 每秒更新
        setInterval(updateTime, 1000);
    </script>
</body>
</html>